package com.eve.springcloud.controller;

import javax.annotation.Resource;

import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

import com.eve.common.util.Jsons;

@RestController
public class DeptController {
    
	@Resource
	private RestTemplate restTemplate;
	/**
	 * 请求地址:单机版
	 */
//	public static final String URL = "http://localhost:8001/";
	/**
	 * Zookeeper版：在Zookeeper中注册的名称，需要在RestTemplate中添加负载均衡支持
	 */
	public static final String URL = "http://cloud-payment-service/";
	
	@RequestMapping(value = "/dept/find/{deptId}")
	public @ResponseBody Jsons find(@PathVariable("deptId") Long deptId) {
		Jsons get = restTemplate.getForObject(URL + "dept/find/" + deptId, Jsons.class);
		return get;
	}
	
}
